﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class manage_label_Label_List : WFinger.Web.UI.ManagePage
{
    public manage_label_Label_List()
    {
        Authority_Code = "T008";
    }
    protected void Page_Load(object sender, EventArgs e)
    {

        #region Ajax
        //if (Request.Form["Option"] != null && Request.Form["Option"].Equals("DeleteFreeLabel"))
        //{
        //    this.Authority_Code = "T009";
        //    this.CheckAdminAuthority();
        //    int id = int.Parse(Request.Form["ID"]);
        //    WFinger.CMS.Label fb = new WFinger.CMS.Label();
        //    try
        //    {
        //        if (fb.LabelDel(id.ToString())
        //            Response.Write("1%成功删除该自由标签!");
        //        else
        //            Response.Write("0%删除失败,该自由标签不存在!");
        //    }
        //    catch (Exception ex)
        //    {
        //        Response.Write("0%操作失败,失败信息:" + ex.Message);
        //    }
        //    Response.End();
        //}
        #endregion Ajax

        //this.PageNavigator1.OnPageChange += new PageChangeHandler(this.PageNavigator1_OnPageChange);
        if (!Page.IsPostBack)
        {
            //WFinger.CMS.Label fb = new WFinger.CMS.Label();
            //WFinger.AccessDAL.Label lb = new WFinger.AccessDAL.Label();
            //DataTable dt = lb.getLableList("0", 1);
            //this.RptFreeLabel.DataSource = dt;

            //this.RptFreeLabel.DataBind();
            ListDataBind(1);
        }
    }

    protected void PageNavigator1_OnPageChange(object sender, int PageIndex)
    {
        ListDataBind(PageIndex);
    }

    private void ListDataBind(int PageIndex)
    {
        int nRCount, nPCount;
        WFinger.Model.SQLConditionInfo sqlc = new WFinger.Model.SQLConditionInfo("@SiteID", 0);

        DataTable tb = WFinger.CMS.Pagination.GetPage(this.GetType().Name, PageIndex, PAGESIZE, out nRCount, out nPCount, sqlc);
        this.PageNavigator1.PageCount = nPCount;
        this.PageNavigator1.RecordCount = nRCount;
        this.PageNavigator1.PageIndex = PageIndex;
        this.RptFreeLabel.DataSource = tb;
        this.RptFreeLabel.DataBind();
    }
}
